package com.f1ussh.serviceuser.dto;

import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;

/**
 * @Author: 马腾飞
 * @CreateTime: 2025-10-01
 * @Description: 分页DTO
 * @Version: 1.0
 */

@Data
public class PageDTO {
    @Min(value = 1, message = "页码不能小于1")
    private Integer page = 1;

    @Min(value = 1, message = "每页大小不能小于1")
    @Max(value = 100, message = "每页大小不能大于100")
    private Integer size = 10;

    @Pattern(regexp = "^(username|nickname|email|phone|create_time|update_time)?$", message = "排序字段不合法")
    private String sortBy = "create_time";

    @Pattern(regexp = "^(asc|desc|ASC|DESC)?$", message = "排序方向不合法")
    private String sortOrder = "DESC";
}